package twel.probenprophet.profile.spells.xdiml2;

import java.io.Writer;
import java.util.Collection;

import twel.probenprophet.profile.jaxb.JaxbXmlWriter;
import twel.probenprophet.profile.spells.xdiml2.jaxb.SpellDefinition;
import twel.probenprophet.profile.spells.xdiml2.jaxb.XdimlContent;
import twel.probenprophet.profile.spells.xdiml2.jaxb.XdimlRootElement;

public class SpellXmlWriter {

	private final JaxbXmlWriter jaxbXmlWriter;

	public SpellXmlWriter(JaxbXmlWriter jaxbXmlWriter) {
		this.jaxbXmlWriter = jaxbXmlWriter;
	}

	public void write(Collection<SpellDefinition> spells, Writer writer) {
		XdimlContent xdimlContents = new XdimlContent();
		xdimlContents.setSpells(spells);

		XdimlRootElement xdimlRoot = new XdimlRootElement();
		xdimlRoot.setXdimlContents(xdimlContents);

		jaxbXmlWriter.writeXml(xdimlRoot, writer);
	}
}
